package com.keepers.repair.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.keepers.repair.R
import com.keepers.repair.helper.SpHelper
import com.keepers.repair.model.RepairModel

class RepairAdapter(layoutResId: Int) : BaseQuickAdapter<RepairModel, BaseViewHolder>(layoutResId) {

    override fun convert(helper: BaseViewHolder?, item: RepairModel?) {
        helper?.setText(R.id.item_repair_info, item?.RepairInfor)
        helper?.setText(R.id.item_repair_date, item?.SubmitTime)
        helper?.setText(R.id.item_repair_placeName, item?.PlaceName)
        helper?.setText(R.id.item_repair_name, SpHelper.getLoginUserInfo().Name)
        if (item?.RIsState == 1) {
            helper?.setText(R.id.item_repair_button, "待检修")
            helper?.addOnClickListener(R.id.item_repair_button)
        } else {
            helper?.setText(R.id.item_repair_button, "已检修")
            helper?.setOnClickListener(R.id.item_repair_button, null)
        }
    }
//    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
//        val item = list[position]
//        holder.info.text = item.Info
//        holder.data.text = item.SubmitTime
//        holder.button.setOnClickListener {
//            it.context.startActivity<SendActivity>("id" to item.Gid)
//        }
//    }
}
